<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
<script src="${pageContext.request.contextPath}/static/js/jquery.js"></script>
<script src="${pageContext.request.contextPath}/static/js/pintuer.js"></script>
<script type="text/javascript" src="../static/plugin/zTree_v3/js/jquery-1.4.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="../static/plugin/zTree_v3/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" src="../static/plugin/zTree_v3/js/jquery.ztree.all.min.js"></script>
<!-- <script type="text/javascript">
$(document).ready(function(){
	
	 $("form").submit(function(e){
			var ids = [], nodes = tree.getCheckedNodes(true);
			for(var i=0; i<nodes.length; i++) {
				ids.push(nodes[i].id);
			}
			$("#menuIds").val(ids);
			loading('正在提交，请稍等...');
			form.submit();
		}) 
	

	var setting = {
		   /*  "check": {
		        "enable": true,
		        "nocheckInherit": true
		    }, */
		    "view": {
		        "selectedMulti": false
		    },
		    "data": {
		        "simpleData": {
		            "enable": true
		        }
		    },
		    "callback": {
		    	onClick: zTreeOnClick
		    }
		};
	
	// 用户-菜单
	
	var zNodes= eval('${areaList}');
	// 初始化树结构
	var tree = $.fn.zTree.init($("#menuTree"), setting, zNodes);
	// 不选择父节点
	tree.setting.check.chkboxType = { "Y" : "ps", "N" : "s" };
	setInterval(()=>{
		var treeObj = tree.getCheckedNodes();
		//var nodes = treeObj.getCheckedNodes(true);
		console.log(treeObj);
	},2000); 
	// 默认选择节点
	var ids = "".split(",");
	for(var i=0; i<ids.length; i++) {
		var node = tree.getNodeByParam("id", ids[i]);
		try{tree.checkNode(node, true, false);}catch(e){}
	}
	// 默认展开全部节点
	tree.expandAll(true);

})
function zTreeOnClick(event, treeId, zNodes) {
		var Mname = zNodes.name;
		var Mid = zNodes.id;
		$("#pname").val(Mname);
		$("#pid").val(Mid);
	    alert(Mid + ", " + Mname);
	    
	};

</script> -->
<script type="text/javascript">
//异步检验账号是否存在
function doVerify(){
    //获取界面的账号
    var medicalname =  $("#medicalname").val();
    /* alert(account) */
    //获取账号后的提示信息文本
   /*  var accountText = document.getElementById("accountText"); */
    //如果账号输入不为空，执行该方法
    if(medicalname !=""){
        $.ajax({
            url:"${pageContext.request.contextPath}/sys/person.do?method=editPersonInfo",//后台查询验证的方法
            data:{"medicalname": medicalname},//携带的参数
            type: "post",
            success: function(msg){
                //根据后台返回前台的msg给提示信息加HTML
                if("true" !=msg){
                	display.innerHTML = "<font color='#e33'>"+medicalname+"已存在！</font>"
                	}
                else{
                	 // 账号不存在
                    display.innerHTML = "<font color='#61daa5'>"+medicalname+"可以使用！</font>"
                }
                }
              

            /* success: function(data){
            	 var result = jQuery.parseJSON(data);
                 $('#display b').text(result.res);
            } */
        });
    }
}

</script>
<!-- <script type="text/javascript">
		$(function(){
			$("#areaContry").change(function(){
			 	var url = "${pageContext.request.contextPath}/sys/area.do?method=findTownInfoByCode";
			    var areacode = $("#areaContry").find("option:selected").val();
			    
			    $("#areaTown option:not(:first)").remove();
			    $("#areaVillage option:not(:first)").remove();
			    $("#areaGroup option:not(:first)").remove();
			    $.post(url,{"areacode":areacode},function(data){
					for(var i = 0; i < data.length; i++){
						$("#areaTown").append("<option  value='"+data[i].areaCode+"'>"+data[i].areaName+"</option>");
					}
				},"json");
			    
			}); 
		});
	$(function(){
			$("#areaTown").change(function(){
			      var url = "${pageContext.request.contextPath}/sys/area.do?method=findVillageInfoByCode";
			      var areacode = $("#areaTown").find("option:selected").val();
			      $("#areaVillage option:not(:first)").remove();
			      $("#areaGroup option:not(:first)").remove();
			      $.post(url,{"areacode":areacode},function(data){
				    for(var i = 0; i < data.length; i++){
			           $("#areaVillage").append("<option  value='"+data[i].areaCode+"'>"+data[i].areaName+"</option>");
					}
				},"json");
			});
		});
	$(function(){
		$("#areaVillage").change(function(){
		      var url = "${pageContext.request.contextPath}/sys/area.do?method=findGroupInfoByCode";
		      var areacode = $("#areaVillage").find("option:selected").val();
		      $("#areaGroup option:not(:first)").remove();
		      $.post(url,{"areacode":areacode},function(data){
			    for(var i = 0; i < data.length; i++){
		           $("#areaGroup").append("<option  value='"+data[i].areaCode+"'>"+data[i].areaName+"</option>");
				}
			},"json");
		});
	});
	</script>  -->
	<script type="text/javascript">
    var national = [
            "汉族", "壮族", "满族", "回族", "苗族", "维吾尔族", "土家族", "彝族", "蒙古族", "藏族", "布依族", "侗族", "瑶族", "朝鲜族", "白族", "哈尼族",
            "哈萨克族", "黎族", "傣族", "畲族", "傈僳族", "仡佬族", "东乡族", "高山族", "拉祜族", "水族", "佤族", "纳西族", "羌族", "土族", "仫佬族", "锡伯族",
            "柯尔克孜族", "达斡尔族", "景颇族", "毛南族", "撒拉族", "布朗族", "塔吉克族", "阿昌族", "普米族", "鄂温克族", "怒族", "京族", "基诺族", "德昂族", "保安族",
            "俄罗斯族", "裕固族", "乌孜别克族", "门巴族", "鄂伦春族", "独龙族", "塔塔尔族", "赫哲族", "珞巴族"
    ];
    window.onload = function ()
    {
        var nat = document.getElementById ("national");
        for ( var i = 0; i < national.length; i++)
        {
            var option = document.createElement ('option');
            option.value = i;
            var txt = document.createTextNode (national[i]);
            option.appendChild (txt);
            nat.appendChild (option);
        }
    }
</script>
</head>
<body>

<div class="panel admin-panel">

  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加参合农民档案</strong></div>
  
  <div class="body-content">
   
    <form method="post" class="form-x" action="${pageContext.request.contextPath}/sys/person.do?method=editPersonInfo&tgId=${tgId}&pageNum=1">  
    	<!-- 县级 -->
      <%-- <div class="form-group">
        <div class="label">
          <label>请选择所在县</label>
        </div>
        <div class="field">
         	<select id="areaContry" name="areaContry" style="padding:5px 15px; border:1px solid #ddd;" data-validate="required:请选择县">
            <option value="">请选择所在县</option>
           	<c:forEach items="${requestScope.contryAreas }" var="area">
           	<option value="${area.areaCode}">${area.areaName}</option>
           	</c:forEach>
          	</select>
          	
          <div class="tips"></div>
        </div>
      </div>
      <!-- 镇级 -->
      <div class="form-group">
        <div class="label">
          <label>请选择所在乡镇</label>
        </div>
        <div class="field">
         	<select id="areaTown" name="areaTown" style="padding:5px 15px; border:1px solid #ddd;"  data-validate="required:请选择乡镇">
            <option value="">请选择所在乡镇</option>
          	</select>
          <div class="tips"></div>
        </div>
      </div>
      <!-- 村级 -->
      <div class="form-group">
        <div class="label">
          <label>请选择所在村</label>
        </div>
        <div class="field">
         	<select id="areaVillage" name="areaVillage" style="padding:5px 15px; border:1px solid #ddd;"  data-validate="required:请选择村">
            <option value="">请选择所在村</option>
            
          	</select>
          <div class="tips"></div>
        </div>
      </div>
      <!-- 组级 -->
      <div class="form-group">
        <div class="label">
          <label>请选择所在组</label>
        </div>
        <div class="field">
         	<select  id="areaGroup" name="groupArea" style="padding:5px 15px; border:1px solid #ddd;" data-validate="required:请选择组">
            <option value="">请选择所在组</option>
          
          	</select>
          <div class="tips"></div>
        </div>
      </div>
      <!-- <div class="form-group">
        <div class="label">
          <label>家庭编号</label>
        </div>
        
        <div class="field">
          <input id="familyCode" type="text" class="input w50" value="" name="familyCode" data-validate="required:家庭编号" onchange="doVerify()"/>
          <div class="tips" id="display"></div>
        </div>
      </div> -->
      
      <div class="form-group">
        <div class="label">
          <label>户属性</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="familyProperty" data-validate="required:请输入户属性" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>户主姓名</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="familyHolder" data-validate="required:请输入户主姓名" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>家庭人口数</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="familyPersonCounts" data-validate="required:请输入家庭人口数" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>农业人口数</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="agriculturePersonCounts" data-validate="required:请输入农业人口数" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>家庭住址</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="familyAddress" data-validate="required:请输入家庭住址" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>创建档案时间</label>
        </div>
        
        <div class="field">
          <input type="date" class="input w50" value="" name="createRchivesTime" data-validate="required:请输入创建档案时间" />
          <div class="tips"></div>
        </div>
      </div>
      
       <div class="form-group">
        <div class="label">
          <label>登记员</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="Registrarer" data-validate="required:请输入登记员" />
          <div class="tips"></div>
        </div>
      </div> --%>
      
      <!-- 户主信息 -->
     <div class="form-group">
        <div class="label">
          <label>家庭编号</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.familyCode }" name="familyCode" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>农合证号</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.farmingcardCode }"name="farmingcardCode" />
          <div class="tips"></div>
        </div>
      </div>
      
       <div class="form-group">
        <div class="label">
          <label>医疗证卡号</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50"  value="${person.medicalcardCode }" name="medicalcardCode" />
          <div class="tips"></div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>姓名</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.name }" name="Name" />
          <div class="tips"></div>
        </div>
      </div>
      
       <div class="form-group">
        <div class="label">
          <label>户内编号</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.familyInCode }" name="familyInCode" data-validate="required:请输入户内编号" />
          <div class="tips"></div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>与户主关系</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.holderRelation }" name="holderRelation" data-validate="required:请输入户内编号" />
          <div class="tips"></div>
        </div>
      </div>
      
      <input type="hidden" name="holderRelation" value="户主" />
       <div class="form-group">
        <div class="label">
          <label>身份证号</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.idcardNumber }" name="idcardNumber" data-validate="required:请输入身份证号" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>性别</label>
        </div>
        
        <div class="field">
        	
          	男<input type="radio" value="1" name="Sex" checked="checked"/>
       		女<input type="radio" value="2" name="Sex"/>
          <div class="tips">
          </div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>出生日期</label>
        </div>
        
        <div class="field">
          <input type="date" class="input w50" value="${person.birthday }" name="Birthday" data-validate="required:请输入出生日期" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>民族</label>
        </div>
        
        <div class="field">
        	<!-- <select id="national" name="Nation" class="input w50">
    		</select> -->
          <input type="text" class="input w50" value="${person.nation }" name="Nation" data-validate="required:请输入民族" /> 
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>健康状况</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.health }" name="Health" data-validate="required:请输入健康状况" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>文化程度</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.cultrueDegree }" name="cultrueDegree" data-validate="required:请输入文化程度" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>人员属性</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.personProperty }" name="personProperty" data-validate="required:请输入人员属性" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>是否农业户口</label>
        </div>
        
        <div class="field">
          农业户口<input type="radio" value="1" name="isContryside" checked="checked"/>
          城镇户口<input type="radio" value="2" name="isContryside">
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>婚姻状况</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.isMarry }" name="isMarry" data-validate="required:请输入婚姻状况" />
          <div class="tips"></div>
        </div>
      </div>
      
       <div class="form-group">
        <div class="label">
          <label>工作单位</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.workAddress }" name="workAddress" data-validate="required:请输入工作单位" />
          <div class="tips"></div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>职业</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.occupation }" name="Occupation" data-validate="required:请输入工作单位" />
          <div class="tips"></div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>常住地址</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.oftenAddress }" name="oftenAddress" data-validate="required:请输入工作单位" />
          <div class="tips"></div>
        </div>
      </div>
      
      
       <div class="form-group">
        <div class="label">
          <label>联系电话</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="${person.phoneNumber }" name="phoneNumber" data-validate="required:请输入联系电话" />
          <div class="tips"></div>
        </div>
      </div>
      
      
      
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
        </div>
        </div>
      
     
	  
    </form>
  </div>
  
</div>

</body>
</html>